﻿namespace DotNetUtility.Parser.Test
{
    using DotNetUtility.Parser;
    using NUnit.Framework;

    [TestFixture]
    public class RegularExpressionParserTest
    {
        [Test]
        public void IsAlphaNumeric()
        {
            string itemToCheck = "AAA";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsAlphaNumeric(itemToCheck));
        }

        [Test]
        public void IsAlphaNumericAndSizeLimitOf()
        {
            string itemToCheck = "AAA";
            int sizeTo = 3;
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsAlphaNumericAndSizeLimitOf(itemToCheck, sizeTo));
        }

        [Test]
        public void IsAlphaNumericWithNoOfDigitsAtFront()
        {
            string itemToCheck = "333a";
            int sizeTo = 3;
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsAlphaNumericWithNoOfDigitsAtFront(itemToCheck, sizeTo));
        }

        [Test]
        public void IsNumericWithNoOfDigits()
        {
            string itemToCheck = "33333";
            int sizeTo = 5;
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsNumericWithNoOfDigits(itemToCheck, sizeTo));
        }

        [Test]
        public void IsNumericInRangeOf()
        {
            string itemToCheck = "5555555555555555";
            int startOfRange = 4;
            int endOfRange = 7;
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsNumericInRangeOf(itemToCheck, startOfRange, endOfRange));
        }

        [Test]
        public void IsAlphabetic()
        {
            string itemToCheck = "s121212";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsAlphabetic(itemToCheck));
        }

        [Test]
        public void IsAlphabeticInRangeOf()
        {
            string itemToCheck = "zxzxAAA";
            int startOfRange = 4;
            int endOfRange = 7;
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsAlphabeticInRangeOf(itemToCheck, startOfRange, endOfRange));
        }


        [Test]
        public void IsAlphabeticInUppercase()
        {
            string itemToCheck = "UPPERCASE";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsAlphabeticInUppercase(itemToCheck));
        }

        [Test]
        public void IsAlphabeticInLowercase()
        {
            string itemToCheck = "lowercase";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsAlphabeticInLowercase(itemToCheck));
        }

        [Test]
        public void IsValidEmailAddress()
        {
            string itemToCheck = "lower_cas233e@ddoo.com";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsValidEmailAddress(itemToCheck));
        }

        [Test]
        public void IsArticle()
        {
            string itemToCheck = "tahe";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsArticle(itemToCheck));
        }

        [Test]
        public void IsVowel()
        {
            string itemToCheck = "i";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsVowel(itemToCheck));
        }

        [Test]
        public void IsFirstLetterIsInAlphabetSet()
        {
            string itemToCheck = "DFDDDDDDDDDDDDDDDDDD";
            string alphabetSet = "D";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsFirstLetterIsInAlphabetSet(itemToCheck, alphabetSet));
        }

        [Test]
        public void IsFirstLetterIsNotInAlphabetSet()
        {
            string itemToCheck = "DFDDDDDDDDDDDDDDDDDD";
            string alphabetSet = "DDD";
            bool expectedResult = true;
            Assert.AreEqual(expectedResult, RegularExpressionParser.IsFirstLetterIsNotInAlphabetSet(itemToCheck, alphabetSet));
        }

    }
}
